﻿using System.Data;

namespace DAL
{
    public static class DalInterviewDetail
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetInterviewDetail(int Interview_ID)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_ID", Interview_ID);
            return Cls.GetData("sp_Interview_Detail_Get");
        }
        public static DataTable GetInterviewDetailTemp(int Users_Id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Users_Id", Users_Id);
            return Cls.GetData("sp_Interview_Detail_GetTemp");
        }
        public static DataTable GetInterviewDetailEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_Detail", id);
            return Cls.GetData("sp_Interview_Detail_Get_Edit");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtInterviewDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_ID", obj.Interview_ID);
            Cls.AddParameter("@Interview_Questions", obj.Interview_Questions);
            Cls.AddParameter("@Interview_Answer", obj.Interview_Answer);
            Cls.AddParameter("@Interview_Poit", obj.Interview_Poit);
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            Cls.AddParameter("@Flag", obj.Flag);
            return Cls.ExecuteNonQuery("sp_Interview_Detail_Insert");
        }
        public static bool Update(EtInterviewDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_Detail", obj.Interview_Detail);
            Cls.AddParameter("@Interview_ID", obj.Interview_ID);
            Cls.AddParameter("@Interview_Questions", obj.Interview_Questions);
            Cls.AddParameter("@Interview_Answer", obj.Interview_Answer);
            Cls.AddParameter("@Interview_Poit", obj.Interview_Poit);
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            Cls.AddParameter("@Flag", obj.Flag);
            return Cls.ExecuteNonQuery("sp_Interview_Detail_Update");
        }
        public static bool Delete(EtInterviewDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_Detail", obj.Interview_Detail);
            return Cls.ExecuteNonQuery("sp_Interview_Detail_Delete");
        }
        public static bool DeleteTemp(EtInterviewDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Users_Id ", obj.Users_Id);
            return Cls.ExecuteNonQuery("sp_Interview_Detail_DeleteTemp");
        }
        public static bool Answer(EtInterviewDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Interview_Detail", obj.Interview_Detail);
            Cls.AddParameter("@Interview_Answer", obj.Interview_Answer);
            return Cls.ExecuteNonQuery("sp_Interview_Detail_Answer");
        }
        #endregion
    }

    public class EtInterviewDetail
    {
        public int Interview_Detail { get; set; }
        public int? Interview_ID { get; set; }
        public string Interview_Questions { get; set; }
        public string Interview_Answer { get; set; }
        public float? Interview_Poit { get; set; }
        public int? Users_Id { get; set; }
        public int? Flag { get; set; }
    }
}